import { ApiProperty } from "@nestjs/swagger";
import { Transform } from "class-transformer";
import { IsInt, IsOptional, Max, Min } from "class-validator";

export class BaseQueryDto {
    @ApiProperty({ minimum: 1, maximum: 20, description: "查询限制" })
    @Min(1)
    @Max(20)
    @IsInt()
    @Transform(({ value }) => parseInt(value))
    @IsOptional()
    limit?: number;

    @ApiProperty({ minimum: 1, description: "查询页" })
    @Min(1)
    @IsInt()
    @Transform(({ value }) => parseInt(value))
    @IsOptional()
    page?: number;
}
